﻿<%@ Page Language="C#" Title="预防性养护方案"  MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="PrevenplanPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Preventive.PrevenplanPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>

    <script type="text/javascript">

      
        //提取最佳年份
        function SetYear() {
            var anniname = $('#cmbAnniName').combobox("getValue");
            var analy_year = $('#cmbAnaly_Year').combobox("getValue");
            if (!anniname && !analy_year) {
                $.messager.alert('消息提示', '请选择资金模型名称分析年度！', 'warning');
                return;
            }

            $.ajax({
                url: "/api/prevenplan/setyear?anniname=" + anniname + "&analy_year=" + analy_year + "",
                type: "GET",
                success: function () {
                    $.messager.alert('成功', '提取最佳年份!', "info");
                    $('#dg').datagrid({ url: '/api/prevenplan', pageNumber: 1 });
                },
                error: function (err) {
                    $.messager.alert('错误提示', '提取最佳年份失败 -' + err, "error");
                }
            });
        }


        function search(n, o) {
            var anniname = $('#cmbAnniName').combobox("getValue");
            var analy_year = $('#cmbAnaly_Year').combobox("getValue");

            var url = '/api/prevenplan';
            var urlParam = "";
            if (anniname != "" && anniname != "0") urlParam += "anniname=" + encodeURI(anniname) + "&";
            if (analy_year != "" && analy_year != "0") urlParam += "analy_year=" + encodeURI(analy_year) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }


        $(function () {
            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            loadAdmDiv();
            dataGridBind($('#dg'), '/api/prevenplan', '预防性养护方案', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

    </script>    

    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <th data-options="field:'Analy_Year',editor:'text',width:100,align:'right' ">分析年度</th>
            <th data-options="field:'Rdwayid',editor:'text',width:80,align:'right' ">路线编号</th>
            <th data-options="field:'Mainsegid',editor:'text',width:300,align:'right' ">养护路段</th>
            <th data-options="field:'Meas_Ini',editor:'numberbox',width:150,align:'right' " >预防性养护措施</th>
            <th data-options="field:'Main_Year',editor:'numberbox',width:80,align:'right' " >实施年份</th>
            

        </thead>
    </table>
   
    <div id="tb">
        <%-- <select id="cmbRoads" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路线编号',url:'/api/roadway/dict',method:'get',valueField:'id',textField:'id',onChange:search">
         </select>--%>
       <%-- <select id="cmbRoadnetId" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路网名称',url:'/api/roadnet/getroadnet',method:'get',valueField:'id',textField:'text'">
         </select>--%>

         <select id="cmbAnniName" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'资金模型名称',url:'/api/dfcostmodpara/anniname',method:'get',valueField:'id',textField:'id'">
         </select>


         <select id="cmbAnaly_Year" class="easyui-combobox" name="cmbAnaly_Year" data-options="prompt:'分析年度',onChange:search" style="width:100px;">   
            <option value="2015">2015年</option>   
            <option value="2016">2016年</option>   
            <option value="2017">2017年</option>   
            <option value="2018">2018年</option>   
            <option value="2019">2019年</option>   
        </select>  
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="SetYear()">提取最佳年份</a>
    </div>

    

    
</asp:Content>

